package 数组;

import java.util.Stack;

/**
 * @Author: biubiu0002
 * @Date: 2021-06-20 2:16
 **/
public class 回文数 {
    public static void main(String[] args) {
        int num = 12;
        int halfReverse=0;
        while(halfReverse<num){
/*  0   23432
    2   2343
    23  234
    234 23
*
*
* */
            halfReverse = halfReverse*10+num%10;
            num/=10;
        }
//        System.out.println(num);
//        System.out.println(halfReverse);
        boolean isHuiwen = num==halfReverse||num==halfReverse/10;
        System.out.println(isHuiwen);
        System.out.println(newMethod(121));



    }

    static boolean newMethod(int n){
        Stack<Integer> stack = new Stack<>();
        int num=n;
        int count=0;
        int revNum = 0;
        while(num!=0){
//            stack.push(num%10);
            revNum=revNum*10+num%10;
            num/=10;
            count++;
        }
//        while(count>0){
//            int topElem = stack.pop();
//
//            count--;
//        }
        System.out.println(n);
        System.out.println(revNum);

        if(n==revNum)
            return true;


        return false;

    }

    static int countHuiwenNum(){
        int i=1;

        while (i<=100000){
            /*1.逆序数字*/



        }
        return 0;

    }

    static int reverseNum(int num){
        Stack<Integer> stack = new Stack<>();
        while (num>0){


        }

        return 0;
    }
}
